package com.rich.dmr.utils;

import android.annotation.SuppressLint;

import java.lang.reflect.Method;

public class GetPropUtils {

	private static volatile Method get = null;

	public static String getProp(String key) {
		String value = "UnKnown";
		try {
			if (null == get) {
				synchronized (GetPropUtils.class) {
					if (null == get) {
						@SuppressLint("PrivateApi") Class<?> cls = Class
								.forName("android.os.SystemProperties");
						get = cls.getDeclaredMethod("get", String.class, String.class);
					}
				}
			}
			value = (String) (get.invoke(null, new Object[] { key, value }));
		} catch (Throwable e) {
			e.printStackTrace();
		}
		return value;

	}
}
